﻿<UserControl x:Class="GTServices.WPF.Client.Views.GTSearchDialogView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
        xmlns:cont="clr-namespace:GTServices.WPF.Client.Controls"
        xmlns:controls="clr-namespace:GTServices.WPF.Client.Controls"
        xmlns:convert="clr-namespace:GTServices.WPF.Client.Converters">
    <DockPanel>
        <StackPanel DockPanel.Dock="Bottom">
            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" >
                <cont:ClickableLabel Text="Find"     cal:Message.Attach="[Event Click] = [Action Find]" />
               <!-- <cont:ClickableLabel Text="Save"     cal:Message.Attach="[Event Click] = [Action Save]" /> -->
            </StackPanel>
            <StatusBar>
                <StatusBarItem>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Status}" />
                    </StackPanel>
                </StatusBarItem>
            </StatusBar>
        </StackPanel>
        <DockPanel DockPanel.Dock="Top">
            <DockPanel.Resources>
                <convert:BoolToVisabilityConverter x:Key="boolToVis" />
            </DockPanel.Resources>
            <DockPanel>
                <StackPanel DockPanel.Dock="Top">
                    <GroupBox Header="Find">
                        <StackPanel>
                            <TextBox Text="{Binding SearchPattern, UpdateSourceTrigger=PropertyChanged}" />

                            <CheckBox HorizontalAlignment="Right" IsChecked="{Binding IncludeInResults}" Content="Include in primary results" />

                            <StackPanel Orientation="Horizontal">
                                <Label Content="By.." />
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                    <RadioButton GroupName="By" Content="Extension" IsChecked="{Binding ByExtension}" />
                                    <RadioButton GroupName="By" Content="Language"  />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>
                   

                    <StackPanel Visibility="{Binding ByExtension, Converter={StaticResource boolToVis}, ConverterParameter=NOT}">
                        <GroupBox Header="Language">
                            <ComboBox ItemsSource="{Binding Languages}" DisplayMemberPath="Name" SelectedItem="{Binding Language}" />
                        </GroupBox>
                    </StackPanel>
                    <StackPanel Visibility="{Binding ByExtension, Converter={StaticResource boolToVis}}">
                        <Label Content="Extensions (*.txt, *.*, *.docx, *.etc , prefix required)" />
                        <TextBox Text="{Binding ExtensionsString, UpdateSourceTrigger=PropertyChanged}" />
                    </StackPanel>
                    <StackPanel>
                        <GroupBox Header="Path">
                            <DockPanel>
                                <controls:ClickableLabel cal:Message.Attach="[Event Click] = [Action PickDir()]" Text="Dir" DockPanel.Dock="Right"/>
                                <TextBox Text="{Binding Path}" DockPanel.Dock="Left" />
                            </DockPanel>
                        </GroupBox>
                    </StackPanel>
                   
                </StackPanel>
                <GroupBox Header="Results">
                    <ContentControl cal:View.Model="{Binding GrepResultsTreeView}" />
                </GroupBox>
            </DockPanel>
        </DockPanel>
        
    </DockPanel>
    
</UserControl>
